<template>
  <uv-popup ref="openSettingPopup" mode="bottom" :closeOnClickOverlay="false" :safeAreaInsetTop="true" round="10px" @touchmove.stop.prevent="">
    <view class="open-setting-container">
      <view class="title">需要用户授权位置权限，以获取您附近的房源信息！</view>
      <view class="buttons">
        <uv-button type="primary" shape="circle" open-type="openSetting" @click="openSetting">去设置</uv-button>
        <uv-text type="info" size="28rpx" align="center" :customStyle="{ marginTop: '20rpx' }" text="取 消" @click="cancelSetting" />
      </view>
    </view>
  </uv-popup>
</template>

<script>
import { mapState, mapActions } from 'vuex'

export default {
  name: 'openSetting',
  components: {},
  mixins: [],
  props: {},
  data() {
    return {}
  },
  // 侦听属性
  watch: {
    // 监听是否弹出
    showOpensetting(nv) {
      if (nv) this.$refs.openSettingPopup.open()
      else this.$refs.openSettingPopup.close()
    },
  },
  // 计算属性
  computed: {
    ...mapState('location', ['showOpensetting']),
  },

  created() {},
  mounted() {},
  destroyed() {},
  methods: {
    ...mapActions('location', ['openSetting', 'cancelSetting']),
  },
}
</script>

<style lang="scss" scoped>
.open-setting-container {
  position: relative;
  padding: 40rpx 50rpx;
  height: 300rpx;
  @include flex(column);
  justify-content: space-between;
  .title {
    font-size: 32rpx;
  }
  .buttons {
    margin-top: 40rpx;
  }
}
</style>
